package com.example.springbott.controller;

import com.example.springbott.aspactJ.OperationName;
import com.example.springbott.bean.BaseRespVo;
import com.example.springbott.bean.MarketComment;
import com.example.springbott.bean.common.BaseParam;
import com.example.springbott.bean.zeng.AdminCommentListVo;
import com.example.springbott.bean.zeng.CommentList;
import com.example.springbott.service.AdminCommentService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: zeng
 * @Description:
 * @date: 17:10 2022/11/21
 */


@RestController
@RequestMapping("admin/comment")
public class AdminCommentController {
    @Autowired
    AdminCommentService adminCommentService;

    @RequiresPermissions("admin:comment:list")
    @RequestMapping("list")
    @OperationName("1")
    public BaseRespVo commentList(BaseParam baseParam, CommentList commentList) {
        AdminCommentListVo adminCommentListVo = adminCommentService.commentList(baseParam, commentList);
        return BaseRespVo.ok(adminCommentListVo);
    }

    @RequiresPermissions("admin:comment:delete")
    @RequestMapping("delete")
    @OperationName("1")
    public BaseRespVo delete(@RequestBody MarketComment comment) {
        adminCommentService.delete(comment);
        return BaseRespVo.ok();
    }
}
